package net.borlis.processor.dao.entity;

import net.borlis.processor.dao.entity.common.AuditedEntity;
import net.borlis.processor.dao.entity.common.BaseEntity;
import net.borlis.processor.enumerated.TaskResultContent;
import net.borlis.processor.enumerated.TaskResultType;

import javax.persistence.*;
import java.math.BigInteger;
import java.sql.Blob;

/**
 * Created by borlis on 24.12.2014.
 */
@Entity
@Table(name = "task_result")
public class TaskResultEntity extends BaseEntity implements AuditedEntity {

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private BigInteger id;

    @ManyToOne
    @JoinColumn(name = "fk_task_id", nullable = false)
    private TaskEntity task;

    @Basic
    @Column(name = "content", nullable = false)
    @Enumerated(EnumType.STRING)
    private TaskResultContent content;

    @Basic
    @Column(name = "type", nullable = false)
    @Enumerated(EnumType.STRING)
    private TaskResultType type;

    @Lob
    @Column(name = "value", nullable = false)
    private Blob value;

    public TaskResultEntity() {
        super();
    }

    public BigInteger getId() {
        return id;
    }

    public void setId(BigInteger id) {
        this.id = id;
    }

    public TaskEntity getTask() {
        return task;
    }

    public void setTask(TaskEntity task) {
        this.task = task;
    }

    public TaskResultContent getContent() {
        return content;
    }

    public void setContent(TaskResultContent content) {
        this.content = content;
    }

    public TaskResultType getType() {
        return type;
    }

    public void setType(TaskResultType type) {
        this.type = type;
    }

    public Blob getValue() {
        return value;
    }

    public void setValue(Blob value) {
        this.value = value;
    }
}
